home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / Files / FileLoop.cp < prev    next >
Text File  |  1997-06-28  |  527b  |  39 lines

  1. // FileLoop.cp
  2.  
  3. #ifndef FileLoop_h
  4. #include "FileLoop.h"
  5. #endif
  6. #ifndef FileNotFoundError_h
  7. #include "FileNotFoundError.h"
  8. #endif
  9.  
  10. FileLoop::FileLoop( Directory theDirectory )
  11.   : directory( theDirectory ),
  12.      index( 1 ),
  13.      finished( false )
  14.   {
  15.     GetInfo();
  16.   }
  17.  
  18. void FileLoop::operator++()
  19.   {
  20.     Assert( !finished );
  21.     index++;
  22.     GetInfo();
  23.   }
  24.  
  25. void FileLoop::GetInfo()
  26.   {
  27.     Assert( !finished );
  28.     
  29.     try
  30.       {
  31.         info.Get( directory, index );
  32.       }
  33.      catch ( FileNotFoundError error )
  34.       {
  35.         error.Fix();
  36.         finished = true;
  37.       }
  38.   }
  39.